import Vue from "vue";
// import store from "../store";
import VueRouter from "vue-router";
import Admin from "../layout/Admin";
import Index from "../views/Index";
import Login from "../views/Login";
import SignInSignOut from "../views/sign/SignInSignOut";
import SignRecord from "../views/sign/SignRecord";
import SignSetting from "../views/sign/SignSetting";
import PersonalNetDisk from "../views/file/PersonalNetDisk";
import PublicNetDisk from "../views/file/PublicNetDisk";
import AskLeave from "../views/sign/AskLeave";
import CheckLeave from "../views/sign/CheckLeave";
import AddUser from "../views/staff/AddUser";
import EditUser from "../views/staff/EditUser";
import PublicTele from "../views/tele/PublicTele"
import PersonalTele from "../views/tele/PersonalTele"
import DepartTele from "../views/tele/DepartTele"
import EditPostTransfer from "../views/postTransfer/EditPostTransfer"
import AddPostTransfer from "../views/postTransfer/AddPostTransfer"
import CheckNot from '../views/notice/CheckNot'
import ManageNot from '../views/notice/ManageNot'
import PublishNot from '../views/notice/PublishNot'
import Notice from '../views/notice'
import JobsManage from '../views/postTransfer/jobs-manage'

Vue.use(VueRouter);

const routes = [
    {
        path: "/",
        component: Admin,
        children: [
            {
                path: "",
                name: "index",
                component: Index,
            },
            {
                path: "/sign",
                name: "sign",
                component: SignInSignOut,
            },
            {
                path: "/sign-record",
                name: "sign-record",
                component: SignRecord,
            },
            {
                path: "/sign-setting",
                name: "sign-setting",
                component: SignSetting,
            },
            {
                path: "/personal-net-disk",
                name: "personal-net-disk",
                component: PersonalNetDisk,
            },
            {
                path: "/public-net-disk",
                name: "public-net-disk",
                component: PublicNetDisk,
            },
            {
                path: "/ask-leave",
                name: "ask-leave",
                component: AskLeave,
            },
            {
                path: "/check-leave",
                name: "check-leave",
                component: CheckLeave,
            },
            {
                path: "/add-user",
                name: "add-user",
                component: AddUser,
            },
            {
                path: "/edit-user",
                name: "edit-user",
                component: EditUser,
            },
            //公共通讯录
            {
                path: "/public-tele",
                name: "public-tele",
                component: PublicTele,
            },
            //个人通讯录
            {
                path: "/personal-tele",
                name: "personal-tele",
                component: PersonalTele,
            },
            //内部通讯录
            {
                path: "/depart-tele",
                name: "depart-tele",
                component: DepartTele,
            },

            {
                path: "/depart-tele",
                name: "depart-tele",
                component: DepartTele,
            },
            {
                path: "/edit-post-transfer",
                name: "edit-post-transfer",
                component: EditPostTransfer,
            },
            {
                path: "/add-post-transfer",
                name: "add-post-transfer",
                component: AddPostTransfer,
            },
            // 公告
            {
                path: '/CheckNot',
                name: 'CheckNot',
                component: CheckNot
            },
            {
                path: '/ManageNot',
                name: 'ManageNot',
                component: ManageNot
            },
            {
                path: '/PublishNot',
                name: 'PublishNot',
                component: PublishNot
            },
            {
                path: '/Notice',
                name: 'Notice',
                component: Notice
            }, {
                path: '/Jobs-manage',
                name: 'Jobs-manage',
                component: JobsManage
            }
        ]
    },
    {
        name: "login",
        path: "/login",
        component: Login
    },
];

const router = new VueRouter({
    mode: "history",
    routes
});

router.beforeEach((to, from, next) => {
    // if (store.state.auth || to.name == "login") {
    //   next();
    // } else if (from.name == "login" && to.name == "index") {
    //   next();
    // } else {
    //   router.push({ name: "login" })
    // }
    next()
});

export default router
